//index.js
//获取应用实例
const app = getApp()
const net = require("../../../utils/net.js");
const util = require("../../../utils/util.js");
Page({
  data: {
    obj:{
      "mc_sell_followup":0,
      "mc_service_followup": 0,
      "mc_followup": 0,
      "mc_order": 0,
      "mc_sell_followup_today": 0,
      "mc_service_followup_today": 0,
      "mc_sell_order_today": 0,
      "mc_service_order_today": 0
    }
  },
  onPullDownRefresh() {
    this.refresh();
    wx.stopPullDownRefresh();
  },
  refresh() {
    this.getData();
  },
  onShow(){
    if (wx.getStorageSync("followdatachange")){
      this.refresh();
      wx.setStorageSync("followdatachange",false);
    }
    // if (wx.getStorageSync("FollowUpObj") != null || wx.getStorageSync("FollowUpObj")!=undefined)
    // this.setData({
    //   obj:wx.getStorageSync("FollowUpObj")
    // })
  },
  onLoad: function () {
    this.refresh();
  },getData(){
    var that = this;
    wx.showLoading({})
    net.request({
      url: '/GuestFollowUp',
      data:{
        member_ship_id: app.globalData.id
      },success(res){
        var dt = res.data;
        console.log(dt);
        if(dt.flag){
          that.setData({
            obj:dt.data
          })
          wx.setStorageSync("FollowUpObj", dt.data);
        }else{
          wx.showToast({
            title: res.msg,
          })
        }
      },fail(res){

      },complete(){
        wx.hideLoading();
      }
    })
  }, navgo(e){
    var route = e.currentTarget.dataset.route;
    console.log("navgo" + route);
    util.Forward(route);
  }

})
